import { BroadCastCall } from "../../broadCast/BroadCastCall";
import { MessageBlock } from "../../../../../Framework/MQ/MessageBlock";
import { SGroup } from "../../../../../Message/Public/SGroup";
import { GroupUtil } from "../../../view/group/GroupUtil";
import { CopyConfig } from "../../../resource/CopyConfig";
import { NetDispatcher } from "../../../../mvc/core/NetDispatcher";
import { ServerCommand } from "../../../mvc/ServerCommand";
//class CopyGroupInfoCommand
    
    export  class CopyGroupInfoCommand extends BroadCastCall
    {
        constructor(arg1: Object)
        {
            super(arg1);
            return;
        }

        public /* override */ call(arg1: MessageBlock): void
        {
            super.call(arg1);
            var loc1=arg1.messageBase as SGroup;
            _cache.copy.waitingPlayer = loc1.players;
            _cache.copy.players = GroupUtil.getMiniPlayers(loc1.players);
            _cache.copy.allocation = loc1.allocation;
            _cache.copy.groupId = loc1.groupId;
            _cache.copy.groupInfo = loc1;
            if (_cache.copy.isInCopy) 
            {
                _cache.copy.copyInfo = CopyConfig.instance.getInfoByCode(loc1.copyCode);
            }
            NetDispatcher.dispatchCmd(ServerCommand.Copy_PlayerInfoChange, _cache.copy.players);
            return;
        }
    }
